@extends("backend.layout.main")

@section("before.css")
    <link type="text/css" href="/backend/css/common.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/header.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/style.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/style2.css" rel="Stylesheet">
    <link type="text/css" href="/backend/css/project.css" rel="Stylesheet">
@endsection


@section("right_content")

<style>
    /*任务模板页*/
    .templatelist{float:left;padding: 0 10px;width: auto;}
    /*任务模板2*/
    .selectproject {
        float: left;
        min-width: 400px;
        height: 400px;
        overflow: auto;
    }
    .set-input {
        width: 150px;
        height: 30px;
        border: 1px solid #ccc;
        background-color: #fff;
        border-radius: 2px;
        float: left;
        line-height: 30px;
        color: #666;
        margin-right: 10px;

    }
    .set-text {
        text-align: center;
        cursor: pointer;
    }
    .inbox-list {
        position: relative;
        float: left;
        text-indent: 0.5em;
        margin: 10px 0;
        width: 150px;
        background-color: rgb(242, 242, 242);
        border: 1px solid rgb(204, 204, 204);
        display: block;
        height: 30px;
        line-height: 30px;
        padding: 0px 0px 0px 2px;
        border-radius: 2px;
        text-align: center;
    }
    .inbox-list1 {
        margin-right: 10px;
    }
    .btn1 {
        float: left;
        margin-top: 15px;
        background-image: url(../images/btn1.png);
        width: 28px;
        height: 24px;
        border: none;
        cursor: pointer;
    }
    .img-line {
        float: left;
        background: url(../images/line.png);
        width: 18px;
        height: 18px;
        margin-top: 18px;
        visibility: hidden;
    }

    .project-model {
        float: left;
        height: 400px;
        width: 60%;
        overflow: auto;

    }
    .b-blue {
        border-color: #FF6633;
    }
</style>
<!--middle-->
<div class="mainWrapBox">
    <div class="mainBox">

        <h1><a href="/backend/items">项目</a> / {{ $itemInfo['item_name'] }}
<span class="projects-nav">
<a href="/backend/work/download/{{ $itemInfo['id'] }}">文档</a>
    <a class="current-nav" href="/backend/items/task/{{ $itemInfo['id'] }}">任务</a>
    <a href="/backend/items/show/{{ $itemInfo['id'] }}">基本信息</a>
</span>    </h1>

 @if(session()->get('member')['gid']==1)
        <div class="html" style="height: 100%">
            <div class="listWrapbox mt10" id="main-left" style="height: 860px;">

                <h2>任务初始设置</h2>

                <div class="menu-list mt20">
                    <span class="current-menu-template">第1步&nbsp;&nbsp;选择项目流程</span>
                    <span class="ml10 menu-template"> 第2步&nbsp;&nbsp;选择设计师</span>
                </div>
                <input type="hidden" name="start" id="start" value="0">
                <input type="hidden" name="limit" id="limit" value="1">

                <div id="step-1" style="display: block;">
                    <div class="menu-tip mt10">
                        Tips：请从以下模板中选择。未找到合适的模板？<a data-target="#templatePanel" data-toggle="modal" onclick="clearTxt();">创建项目阶段</a>
                    </div>
                    <div class="menu-tip mt10">
                        <span  id="disresolve" class="current-template" style="cursor: pointer">不分解</span>
                        <span id="resolve" style="cursor: pointer">分解</span>
                    </div>
                    <div id="step-1-1" style="display:block">
                        @foreach($templatesInfo as $k=>$v)
                        <div class="wraptemplate" data-id="{{ $v['templates_id'] }}">
                            <div class="templatelist">
                                <div class="templatelist-tit">
                                   {{ $v['templates_name'] }}
                                </div>
                                <span>适用类型：{{ $v['templates_type'] }}</span>
                                <div class="template-content">
                                    <ul>
                                        @foreach($v['stages'] as $value)
                                        <li>{{ $value }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            </div>
                        </div>
                        @endforeach
                        <div class="cl"></div>
                    </div>

                    <div id="step-1-2" style="display:none">

                        <div class="selectproject">
                            <div class="inbox-input">
                                <input  placeholder="输入地块名称,按回车确认" class="set-input addProjectMajor">
                                <div class="set-text set-input addProjectStage">添加流程</div>
                            </div>

                            <div>
                                <div onmouseout="hide_tag(this);" onmousemove="remove_tag(this);">
                                    <div id="add1" class="inbox-list inbox-list1">地块一</div>
                                    <input id="add2" class="inbox-list" type="text" placeholder="请选择项目流程" readOnly="true" >
                                    <input type="button" class="btn1" style="visibility: hidden;">
                                    <div class="img-line"></div>
                                </div>
                            </div>

                            <div>
                                <div onmouseout="hide_tag(this);" onmousemove="remove_tag(this);">
                                    <div id="add1" class="inbox-list inbox-list1">地块一</div>
                                    <input id="add2" class="inbox-list" type="text" placeholder="请选择项目流程" readOnly="true">
                                    <input type="button" class="btn1" style="visibility: hidden;">
                                    <div class="img-line"></div>
                                </div>
                            </div>
                        </div>
                        <div class="project-model">
                            <div class="wraptemplate" data-id="10000">
                                <div class="templatelist">
                                    <div class="templatelist-tit">方案设计项目模板01
                                    </div>
                                    <span>适用类型：建筑设计</span>
                                    <div class="template-content">
                                        <ul>
                                            <li>方案前期策划</li>
                                            <li>方案实施</li>
                                            <li>方案审批配合</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="wraptemplate" data-id="10001">
                                <div class="templatelist">
                                    <div class="templatelist-tit">建筑设计全过程项目模板01
                                    </div>
                                    <span>适用类型：建筑设计</span>
                                    <div class="template-content">
                                        <ul>
                                            <li>方案设计</li>
                                            <li>初步设计</li>
                                            <li>施工图设计</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>

                            <div class="wraptemplate" data-id="10004">
                                <div class="templatelist">
                                    <div class="templatelist-tit">住宅方案设计模板
                                    </div>
                                    <span>适用类型：建筑设计</span>
                                    <div class="template-content">
                                        <ul>
                                            <li>前期准备</li>
                                            <li>方案设计</li>
                                            <li>方案确认</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="wraptemplate" data-id="10002">
                                <div class="templatelist">
                                    <div class="templatelist-tit"> 建筑设计全过程项目模板02
                                    </div>
                                    <span>适用类型：建筑设计</span>
                                    <div class="template-content">
                                        <ul>
                                            <li>方案设计</li>
                                            <li>初步设计</li>
                                            <li>施工图设计</li>
                                            <li>施工配合</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="wraptemplate" data-id="10003">
                                <div class="templatelist">
                                    <div class="templatelist-tit">建筑设计全过程项目模板03
                                    </div>
                                    <span>适用类型：建筑设计</span>
                                    <div class="template-content">
                                        <ul>
                                            <li>前期准备</li>
                                            <li>概念方案设计</li>
                                            <li>报建方案设计</li>
                                            <li>初步设计</li>
                                            <li>施工图设计</li>
                                            <li>施工配合</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="wraptemplate" data-id="10004">
                                <div class="templatelist">
                                    <div class="templatelist-tit">住宅方案设计模板
                                    </div>
                                    <span>适用类型：建筑设计</span>
                                    <div class="template-content">
                                        <ul>
                                            <li>前期准备</li>
                                            <li>方案设计</li>
                                            <li>方案确认</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                            <div class="cl"></div>
                        </div>

                    </div>

                </div>

                <div class="cl"></div>
                <div class="creat-menbers pt">
                    <form action="/backend/items/task_next" method="post" >
                        {{ csrf_field() }}
                        <input id="template_id" name="template_id" type="hidden" value="">
                        <input name="id" type="hidden" value="{{  $itemInfo['id']  }}">
                        <input  class="creat-current" style="cursor: pointer;" type="submit" value="下一步" onclick="return next()"/>
                    </form>

                </div>
            </div>
        </div>
@else
<p style="margin-top: 20px">
<h1 style="text-align: center;">暂未审核，你无权查看任务列表</h1></p>

@endif


    </div>
</div>
</div>
</div>
<script type="text/javascript">
    function next(){
           var tag=$('#step-1-1 div').hasClass('choose-div');
        if(tag){
            return true;
        }else {

            return false;
         }
    }
</script>



    <script src="/backend/js/info.js"></script>
    <script src="/backend/js/laydate.js"></script>
    <script src="/backend/js/function.js"></script>
<script type="text/javascript">

    $(function(){
        foldEve();//显示隐藏
        checkBoxInput();

        $(".wraptemplate").bind("click",function(){
            var that = $(this);
            that.addClass("choose-div");
            that.siblings().removeClass("choose-div");
            projectTaskStage = "";
            that.find("li").each(function(){
                projectTaskStage += "," + $(this).text();
            });
            if(projectTaskStage!=''){
                projectTaskStage = projectTaskStage.substring(1);
            }
            projectTempleteId = that.data("id");
            $('#template_id').val(projectTempleteId);

            //console.log(projectTaskStage);
        });

        $(document).on('click',function(e){
            var ofs=$(e.target).parents().hasClass("fudong_add_td");
            var ofg=$(e.target).hasClass("fudong_add_td");
            var osg=$(e.target).hasClass("Template_name");
            if(!osg) {
                if(ofs || ofg){
                }
                else{
                    $(".fudong_add_td").hide();
                }
            }else{
                $(".fudong_add_td").hide();
                $(e.target).parent().find(".fudong_add_td").show();
            }
        });

    });

</script>
<script type="text/javascript">

    function saveSetting(obj){
        var add=$(obj).parent().parent();
        var text=$(obj).val();
        var html="<div><div onmouseout='hide_tag(this);'' onmousemove='remove_tag(this);'>";
        html+=    "<div id='add1' class='inbox-list inbox-list1'>"+text+"</div>";
        html+=    "<input id='add2' class='inbox-list' type='text' placeholder='请选择项目流程' readOnly='true'>";
        html+=    "<input type='button' class='btn1' style='visibility: hidden;'>";
        html+=    "<div class='img-line'></div>"
        html+="</div></div>";
        if(text==''){
            alert('请输地块名称');
        }else{
            $(add).append(html);
        }

    }

    function saveSetting1(obj){
        var add=$(obj).parent().parent();
        var html="<div><div onmouseout='hide_tag(this);'' onmousemove='remove_tag(this);'>";
        html+=    "<div id='add1' class='inbox-list inbox-list1'>项目名称</div>";
        html+=    "<input id='add2' class='inbox-list' type='text' placeholder='请选择项目流程' readOnly='true'>";
        html+=    "<input type='button' class='btn1' style='visibility: hidden;'>";
        html+=    "<div class='img-line'></div>"
        html+="</div></div>";

        $(add).append(html);
    }

    $(function(){
        $(document).on('keypress','.addProjectMajor',function(e){

            var e=e || event,
                    keycode=e.which || e.keyCode;
            if(keycode==13){
                saveSetting(this);
            }
        });

        $(document).on('click','.addProjectStage',function(e){

            saveSetting1(this);

        });
        $(document).on("click",".btn1",function(){
            $(this).parent().parent().remove();
        })


        $(document).on("click","#add2",function(){

            $(".inbox-list").removeClass('b-blue');
            $('.img-line').css('visibility','hidden');
            $(this).addClass('b-blue');
            $(this).next().next().css('visibility','visible');
        })

        $('.wraptemplate').click(function(){
            var objname=$(this).find('.templatelist-tit').text();
            $('.b-blue').val(objname);
        })

        $('#disresolve').click(function(){
            $('#resolve').removeClass();
            $(this).addClass('current-template');
            $('#step-1-2').css('display','none');
            $('#step-1-1').css('display','block');
        })

        $('#resolve').click(function(){
            $('#disresolve').removeClass();
            $(this).addClass('current-template');
            $('#step-1-2').css('display','block');
            $('#step-1-1').css('display','none');
        })
      /*  $(".creat-current").bind("click",function(){

            var template_id=$('.choose-div').data('id');
            location.href='backend/items/task_next/8/'+template_id;

        });*/
       /* $(".wraptemplate").click(function(){
            var template_id=$(this).data('id');

        })
    })*/
</script>


    @endsection

